#ifndef __MVP_UPGRADE_H__
#define __MVP_UPGRADE_H__

#include "mvvcd.h"
#include "mvp_audio.h"
#if __cplusplus
extern "C" {
#endif

typedef struct _MTD_NODE_INFO_S{
    mv_u8_t    u8_img_type;
    mv_v8ptr_t v8p_block_path;
    mv_v8ptr_t v8p_block_sig;
}T_MTD_NODE_INFO_S;

typedef enum mvp_upgrade_status{
    MVP_UPGRADE_WRITE_FAILED        = -1,
    MVP_UPGRADE_WRITE_SUCCESS       =  0,
    MVP_UPGRADE_NEED_WRITE_BLK      = 10,
}MVP_UPGRADE_STATUS;

typedef struct _UPDATE_INFO_S{
    MVP_UPGRADE_STATUS  e_update_status;
    mv_s32_t            s32_node_id;
    mv_s32_t            s32_file_size;
    mv_v8_t             av8_block_sig[32];   // 32 bytes mtd设备标识 如KER\MVS等
    mv_v8_t             av8_block_path[32];  // 32 bytes mtd设备路径 如/dev/mtd0等
}T_UPDATE_INFO_S;

/**
 * @brief 获取匹配的分区路径
 * @param p_info     [out] 
 * @return mv_s32_t 
 * - success : MV_EC_SUCCESS
 * - failed  : < 0
 */
mv_s32_t mvp_upgrade_get_block_path(T_UPDATE_INFO_S* p_info);

/**
 * @brief 回报刷写分区状态，以进行备份等操作
 * @param p_info     [in] 
 * @return mv_s32_t 
 * - success : MV_EC_SUCCESS
 * - failed  : < 0
 */
mv_s32_t mvp_upgrade_report_status(T_UPDATE_INFO_S* p_info);

/**
 * @brief 升级用音频播放通道资源初始化
 * @param attr [in] < MVP_AUDIO_AO_ATTR_T * >
 * @return mv_s32_t 
 * - success : MV_EC_SUCCESS
 * -  failed : < 0 
 */
mv_s32_t mvp_upgrade_ao_init(MVP_AUDIO_ATTR_T *attr);

/**
 * @brief 播放音频文件
 * @param pv8_filename [in] 文件路径
 * @param s32_loop_cnt [in] 播放次数
 * @return mv_s32_t 
 * - success : MV_EC_SUCCESS
 * -  failed : < 0 
 */
mv_s32_t mvp_upgrade_ao_play_file(mv_cv8ptr_t cpv8_filename, mv_s32_t s32_loop_cnt);

/**
 * @brief 设置音频播放音量大小
 * @param s32_vol [in] < [1-100] >
 * @return mv_s32_t 
 * - success : MV_EC_SUCCESS
 * -  failed : < 0 
 */
mv_s32_t mvp_upgrade_ao_volume_set(mv_s32_t s32_vol);

#if __cplusplus
}
#endif
#endif /* __MVP_UPGRADE_H__ */